import { findHeadCategoryAPI } from '@/api/home'
export default {
  namespaced: true, // 开启命名空间
  state: () => ({

    categoryList: []// 分类列表

  }),
  mutations: {
    setCategoryList (state, newList) {
      state.categoryList = newList
    }
  },
  actions: {
    async asyncSetCategoryList (store) {
      // 调用接口
      const res = await findHeadCategoryAPI()
      // 调用mutations函数
      store.commit('setCategoryList', res.result)
    }
  }
}
